package demo3LinkList;

import demo3LinkList.MyNodeAndMyList.Node;
import demo3LinkList.MyNodeAndMyList.NodeList;
import org.junit.Test;

/**
 * @ClassName O1DeleteNode
 * @Description TODO  O(1)时间复杂度删除单链表的节点；前提：提供链表中的节点
 * @Author shenxinyuan
 * @Date 2021/7/21 $ {TIME}
 * @Version 1. 0
 **/
public class O1DeleteNode {
    @Test
    public void test(){
        NodeList nodeList = new NodeList<>();
        nodeList.addHead(1);
        nodeList.addHead(2);
        nodeList.addHead(3);
        nodeList.addHead(4);

        Node dest = nodeList.getNode(3);    //现获取目标结点

        System.out.println("nodeList.deleteO1(dest) = " + nodeList.deleteO1(dest));
    }
}
